<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Happy dong
 * Created Time: 2019-08-01 19:21
 *
 * Version: 2.0
 */

namespace App\Modules\Employee\Criterias;


use Flower\Core\Repository\Contracts\CriteriaInterface;
use Flower\Core\Repository\Contracts\RepositoryInterface;

class getNewPortfolioListCriteria implements CriteriaInterface
{
	private $member_id;
	private $limit;
	public function __construct($memberId,$pageSize)
	{
		$this->member_id = $memberId;
		$this->limit = $pageSize;
	}

	public function apply($model, RepositoryInterface $repository)
	{
		return $model->leftJoin('user_portfolio',function($query){
			$query->on('user_like.user_id','=','user_portfolio.user_id')
			->on('user_like.store_id','=','user_portfolio.store_id');
		})
			->where('member_id','=',$this->member_id)
			->limit($this->limit);
	}
}